#include <iostream>
using namespace std;
#include <unistd.h>
#include <pthread.h>

pthread_mutex_t mutex;

void* test_mutex(void* args)
{
  pthread_mutex_lock(&mutex);
  pthread_mutex_lock(&mutex);
  pthread_exit((void*)0);
}
int main()
{
  // 申请一个死锁
  pthread_mutex_init(&mutex , NULL);
  pthread_t tid;
  pthread_create(&tid , NULL , test_mutex ,(void *)"new thread");
  pthread_join(tid , NULL);
  pthread_mutex_destroy(&mutex);
  return 0;
}
